from api.api_project import get_contract_df, get_contract_by_lot_code
from common.tb_model import db_to_models
from project.drcs import create_drcs

from PySide2 import QtWidgets
from api.models import DRCS


def main():
    app = QtWidgets.QApplication([])

    table = QtWidgets.QTableWidget(10, 5)  # 创建一个有10行5列的QTableWidget
    table.setHorizontalHeaderLabels(['Column 1', 'Column 2', 'Column 3', 'Column 4', 'Column 5'])

    # 设置列宽可调节
    table.horizontalHeader().setSectionsMovable(True)
    table.insertRow(0)
    for i in range(5):
        for j in range(5):
            table.setItem(i, j, QtWidgets.QTableWidgetItem(str(i)))

    table.show()

    # 运行应用
    app.exec_()


def create_drcs():
    models = db_to_models("drcs", DRCS, "status<1")
    for model in models:
        create_drcs(model)


def get_contract():
    df_contract = get_contract_df()
    # print(df_contract)
    row = df_contract.loc[1]
    print(df_contract.loc[1]["code"])
    row["code"] = "1"
    print(df_contract.loc[1]["code"])


if __name__ == '__main__':
    pass
    df = get_contract_by_lot_code("120Ea")
    value = df.loc[0,"code"]
    print(value)
    # # print(DRCS=="df")
    # list1 = [1,2,3,4,5,6]
    # print(list1[1:])
    # col_value_list = ["007-BT-L-NSCE-F-GENS-7000100", '007-BT-L-NSCE-G-GENS-000023', '007-BT-L-GENS-C-NSCE-400050']
    # id_vaule_list = [1,3,1000,30000]
    # result = is_in_review(id_vaule_list, "id", "fax")
    # print(result)
    # # data = str(id_vaule_list).replace("[", "").replace("]", "")
    # print(str(data))
